package LW.org.serviceImple;

import LW.org.dao.userDao;
import LW.org.model.Admin;
import LW.org.service.userServicelogin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service("userServiceLoginImple")
public class userServiceLoginImple implements userServicelogin {

    @Autowired
    @Qualifier("userDaoImple")
    private userDao userdao;

    @Override
    public Boolean check_out(int id, String password) {
        Admin templateOne = userdao.select(id);
        if (templateOne != null && templateOne.getPassword().trim().equals(password.trim())) {
            return true;
        }

        return false;
    }

    public Admin find_one(int id) {
        Admin templateOne = userdao.select(id);
        if (templateOne != null) {
            return templateOne;
        }
        return null;
    }
}
